<?php

namespace App\Http\Requests;


class CzProductRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'title' => 'required|between:1,100',
            'type' => 'required',
            'isp' => 'required',
            'status' => 'required',

            'specs.*.face_value' => 'required|max:20',
            'specs.*.market_price' => 'required',
            'specs.*.sell_price' => 'required',
            'specs.*.status' => 'required',
            'specs.*.is_cache' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'title.required' => '标题必须填写',
            'title.between' => '标题1-100个字符之间',
            'type.required' => '请选择业务类型',
            'isp.required' => '请选择运营商',
            'status.required' => '请选择状态',

            'item.*.face_value.required' => '面值必须填写',
            'item.*.face_value.max' => '面值最多输入20个字符',
            'item.*.market_price.required' => '面值原价必须填写',
            'item.*.sell_price.required' => '面值默认售价必须填写',
            'item.*.spec_code.required' => '面值产品编码必须填写',
            'item.*.spec_code.max' => '面值产品编码最多输入20个字符',
            'item.*.status.required' => '请选择面值是否上架',
            'item.*.is_cache.required' => '请选择面值是否压单',
        ];
    }
}
